package io.dy.listener;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.annotation.SelectorType;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author : dmj
 * @date: 2024/8/27 4:25 下午
 * @description: 带tag的消息监听器
 */
@Component
@RocketMQMessageListener(
        topic = "bootTagTopic",
        consumerGroup = "tagB-consumer-group",
        selectorType = SelectorType.TAG,
        selectorExpression = "tagB"
)
public class TagBListener implements RocketMQListener<MessageExt> {

    @Override
    public void onMessage(MessageExt messageExt) {
        System.out.println("TagBListener 接收到消息为: " + new String(messageExt.getBody()));
    }
}
